//
//  THAlertViewManager.m
//  MengLiao
//
//  Created by xiuxin on 2022/7/15.
//  Copyright © 2022 BaseBusiness. All rights reserved.
//

#import "THAlertViewManager.h"

@interface THAlertViewManager ()

@property (nonatomic, strong) id bindObject;

@property (nonatomic, strong) NSMutableArray *bindArr;

@end

@implementation THAlertViewManager

+ (THAlertViewManager *)shareManager
{
    static dispatch_once_t onceToken;
    static THAlertViewManager *_instanceAlertView = nil;
    dispatch_once(&onceToken, ^{
        _instanceAlertView = [[THAlertViewManager alloc]init];
    });
    return _instanceAlertView;
}

- (void)bindAlertViewWith:(id)object
{
    for (int i = 0; i < self.bindArr.count; i++) {
        id arrObject = self.bindArr[i];
        if (arrObject == object) {
            return;
        }
    }
    [self.bindArr addObject:object];
}

- (void)deleteAlertViewWith:(id)object
{
    int deleteIndex = -1;
    for (int i = 0; i < self.bindArr.count; i++) {
        id arrObject = self.bindArr[i];
        if (arrObject == object) {
            deleteIndex = i;
            break;
        }
    }
    if (deleteIndex >= 0) {
        [self.bindArr removeObject:object];
    }
}

- (NSMutableArray *)bindArr
{
    if(!_bindArr)
    {
        _bindArr=[[NSMutableArray alloc]init];
    }
    return _bindArr;
}


@end
